/**
 * 
 * 广州锐鹏计算机科技有限公司（www.ruipengkj.com）
 * 
 * 
 * Copyright (c) 2011-2012 RUIPENGKJ.Co.Ltd. All rights reserved.
 * 
 * */
package com.ruipengkj.view.orderView.desk;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.UIManager;

import com.ruipengkj.bean.TCommodity;
import com.ruipengkj.commons.util.Util;
import com.ruipengkj.view.orderView.dish.OrderDishPanel;
import com.ruipengkj.view.orderView.dish.OrderTypePanel;

/**
 * 说明： 下单面板-点菜面板---餐桌处
 */
public class DeskOrderDialog extends JPopupMenu {

	private static final long serialVersionUID = 1L;

	private OrderTypePanel typePanel;// 菜品类型 面板
	private OrderDishPanel orderDishPanel;// 菜品（名称）面板
	private JPanel dishPanel;// 菜品类型、菜品、翻页组建 面板

	public DeskOrderDialog() {
		this.setPreferredSize(new Dimension(760, 460));
		this.setFocusable(false);
		init();
	}

	private void init() {
		typePanel = new OrderTypePanel() {
			private static final long serialVersionUID = 1L;

			@Override
			// 查询菜品
			public void QueryDish(String CatalogId) {
				orderDishPanel.byTypeQueryDish(CatalogId);
			}
		};

		orderDishPanel = new OrderDishPanel() {
			private static final long serialVersionUID = 1L;

			@Override
			// 下单-添加菜品
			public void AddDish(TCommodity tCommodity) {
				addDish(tCommodity);
			}

		};

		dishPanel = new JPanel(new BorderLayout()) {
			private static final long serialVersionUID = 1L;

			@Override
			protected void paintComponent(Graphics g) {
				super.paintComponent(g);
				g.setColor(new Color(234, 99, 0));
				g.drawRect(0, 0, this.getWidth() - 1, this.getHeight() - 1);
			}
		};
//		dishPanel.setOpaque(false);
		orderDishPanel.setOpaque(false);
		typePanel.setOpaque(false);
		dishPanel.add(typePanel, BorderLayout.NORTH);
		dishPanel.add(orderDishPanel, BorderLayout.CENTER);
		dishPanel.setCursor(Util.CURSOR_DEFAULT);

		dishPanel.setBackground(new Color(247, 252, 255));

		this.add(dishPanel);
	}

	//回调函数 
	protected void addDish(TCommodity tCommodity) {
	}
	
	public static void main(String[] args) {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (Exception e) {
			e.printStackTrace();
		}
		new DeskOrderDialog().setVisible(true);
	}
}
